/*
 * @Authoryour name
 * @Date2020-11-28 23:46:56
 * @LastEditTime2020-11-28 23:46:56
 * @LastEditorsyour name
 * @DescriptionIn User Settings Edit
 * @FilePath\STM32H750_FreeRTOS\User\application\led\led_task.c
 */ 
#include "led.h"
#include "bsp_led.h"

StaticTask_t led_task_tcb;
StackType_t led_task_stack[LED_TASK_STACK_SIZE];

static uint8_t led_state = 0;

void led_task(void)
{
    static uint32_t last_time = 0u;
    const uint32_t task_period_ticks = pdMS_TO_TICKS(1000);
    last_time = xTaskGetTickCount();
    for(;;)
    {
        vTaskDelayUntil(&last_time, task_period_ticks);
        if(led_state == 0)
        {
            LED_B_OFF();
            LED_R_ON();
            led_state = 1;
        }
        else
        {
            LED_B_ON();
            LED_R_OFF();
            led_state = 0;
        }
    }
}
